package com.liuzh.fitnessplan.database.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.liuzh.fitnessplan.database.bean.User

@Dao
interface UserDao {
    @Insert
    fun addNewUser(user : User)

    @Query( "SELECT * FROM User WHERE user_account = :account")
    fun haveAccount(account: Int) : List<User>

    @Query("SELECT * FROM User WHERE user_account = :account AND user_passwd = :passwd")
    fun login(account : Int , passwd : String) : List<User>

    @Query("SELECT * FROM User")
    fun getAll() : List<User>

    @Update
    fun update(user: User)
}